<template>
  <div class="dynamic">
    <!-- 头部搜索组件 -->
    <comp-hdserach :ctitle="'动态'"></comp-hdserach>
    <div class="dynamic-nav">
      <a
        @click="myClick(0, 'dyPage01')"
        :class="index == 0 ? 'active' : ''"
        href="javascript:;"
        >动态</a
      >
      <a
        @click="myClick(1, 'dyPage02')"
        :class="index == 1 ? 'active' : ''"
        href="javascript:;"
        >关注</a
      >
    </div>
    <!-- 动态组件 -->
    <div>
      <transition
        :duration="{ enter: 800, leave: 150 }"
        enter-active-class="animate__animated animate__fadeInLeft"
        enter-to-class="animate__animated animate__fadeInLeft"
        leave-active-class="animate__animated animate__fadeOutLeft"
        leave-to-class="animate__animated animate__fadeOutLeft"
      >
        <!-- 动态组件 -->
        <component :is="cName"></component>
      </transition>
    </div>
    <!-- 底部导航组件 -->
    <comp-footer></comp-footer>
  </div>
</template>

<script>
import compHdserach from "../components/comp-hdsearch.vue";
import compFooter from "../components/comp-footer.vue";
import dyPage01 from "../pages/dynamic-page01.vue";
import dyPage02 from "../pages/dynamic-page02.vue";
export default {
  name: "myDynamic",
  data() {
    return {
      cName: "dyPage01",
      index: 0,
      // dynamicData:{},
    };
  },
  components: {
    compHdserach,
    compFooter,
    dyPage01,
    dyPage02,
  },
  methods: {
    myClick(k, z) {
      this.index = k;
      this.cName = z;
    },
  },
};
</script>

<style lang="scss" scoped>
.dynamic-nav {
  width: 100%;
  height: 50px;
  position: fixed;
  top: 46px;
  left: 0;
  // margin-top: 46px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-bottom: 1px solid rgb(241, 241, 241);
  box-sizing: border-box;
  background: #fff;
  a {
    font-size: 14px;
    height: 100%;
    line-height: 46px;
    border-bottom: 2px solid transparent;
  }
  .active {
    color: #2fd5ff;
    border-bottom: 2px solid #2fd5ff;
  }
  &:hover {
    //   针对a标签移动端高亮
    -webkit-tap-highlight-color: transparent;
  }
}
</style>